package chances.wechat.entity;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.Date;

public class WechatStbBind implements java.io.Serializable {

	private static final long serialVersionUID = 4262166571608710059L;

	public static final int ENABLE = 1;
	public static final int DISABLE = 1;

	private Long bindId;
	private String openId;
	private String stbNo;
	private Integer status;
	private String stbDesc;
	private String nickname;
	private Date bindTime;
	private Date createTime;
	private boolean showPhoto = true;
	private boolean showFav = true;
	private boolean showBooking = true;
	private String roleName;
	
	private Boolean master = false;

	public WechatStbBind() {
		super();
	}

	public WechatStbBind(String id, String stb) {
		this.openId = id;
		this.stbNo = stb;
		this.bindTime = new Date();
		this.status = ENABLE;
	}

	public Long getBindId() {
		return bindId;
	}

	public void setBindId(Long bindId) {
		this.bindId = bindId;
	}

	public String getOpenId() {
		return openId;
	}

	public void setOpenId(String openId) {
		this.openId = openId;
	}

	public String getStbNo() {
		return stbNo;
	}

	public void setStbNo(String stbNo) {
		this.stbNo = stbNo;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getStbDesc() {
		try {
            return URLDecoder.decode(stbDesc,"UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            return stbDesc;
        }
	}

	public void setStbDesc(String stbDesc) {
		this.stbDesc = stbDesc;
	}

	public String getNickname() {
		try {
			return URLDecoder.decode(nickname, "utf-8");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		return nickname;
	}

	public void setNickname(String nickname) {
		try {
			this.nickname = URLEncoder.encode(nickname, "utf-8");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
	}

	public Date getBindTime() {
		return bindTime;
	}

	public void setBindTime(Date bindTime) {
		this.bindTime = bindTime;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public boolean isShowPhoto() {
		return showPhoto;
	}

	public void setShowPhoto(boolean showPhoto) {
		this.showPhoto = showPhoto;
	}

	public boolean isShowFav() {
		return showFav;
	}

	public void setShowFav(boolean showFav) {
		this.showFav = showFav;
	}

	public boolean isShowBooking() {
		return showBooking;
	}

	public void setShowBooking(boolean showBooking) {
		this.showBooking = showBooking;
	}

	public String getRoleName() {
		return roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

    /**
     * @return the master
     */
    public Boolean getMaster() {
        return master;
    }

    /**
     * @param master the master to set
     */
    public void setMaster(Boolean master) {
        this.master = master;
    }

}
